from itsdangerous import TimedJSONWebSignatureSerializer as TJSW

def Jia_mi(openid):
    #创建对象
    s = TJSW(secret_key='oauth',expires_in=300)
    #对openid进行加密
    sign_openid = s.dumps({'openid':openid})
    #返回结果
    return sign_openid.decode()

def Jie_mi(data):
    a = TJSW(secret_key='jie_mi',expires_in=300)
    try:
        data_dict = a.loads({"data":data})
    except Exception:
        return None
    return data_dict.get('data')
